﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Sistema_de_Patrimonio.Common_Files
{
    public class Connection
    {
      //  public static String ConnectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=Patrimonio0811;Integrated Security=true";
       public static String ConnectionString = "Data Source=SRV-DB-1;Initial Catalog=PatrimonioDB;Integrated Security=True";
       //  public static String ConnectionDeposito = "Data Source=.\\SQLEXPRESS;Initial Catalog=depo06052013;Integrated Security=true";
       public static String ConnectionDeposito = "Data Source=SRV-DB-1;Initial Catalog=dimprenta_deposito;Integrated Security=True";

        public static SqlConnection OpenConecction()
        {
            SqlConnection Connection = new SqlConnection(Common_Files.Connection.ConnectionString);
            Connection.Open();
            return (Connection);
        }

        public static void CloseConecction(SqlConnection Connection, SqlCommand Command)
        {
            Command.ExecuteNonQuery();
            Connection.Close();
        }

        public static SqlConnection OpenConecctionDeposito()
        {
            SqlConnection Connection = new SqlConnection(Common_Files.Connection.ConnectionDeposito);
            Connection.Open();
            return (Connection);
        }

        public static void OpenConecctionDeposito(SqlConnection Connection, SqlCommand Command)
        {
            Command.ExecuteNonQuery();
            Connection.Close();
        }
    }
}